//
//  PayApi.m
//  PayDemo
//
//  Created by HanHan on 2017/8/1.
//  Copyright © 2017年 HanHan. All rights reserved.
//

#import "PayApi.h"
#import "AES.h"
#import "AFNetworking.h"
#import "NetworkingTools.h"
//URL
#define PAYURL(accountId,amount,bankCardId,operName,password) [NSString stringWithFormat:@"http://192.168.59.2:9007/withdraw?accountId=%@&amount=%@&bankCardId=%@&operName=%@&password=%@",accountId,amount,bankCardId,operName,password]

@implementation PayApi

+(void)requestNet:(NSString *)accountId amount:(NSString *)amount bankCardId:(NSString *)bankCardId operName:(NSString *)operName password:(NSString *)password completionBlock:(void (^)(NSString *, NSError *))completionBlock
{
    NSString *oSign = [NSString stringWithFormat:@"accountId=%@&amount=%@&bankCardId=%@&operName=%@&password=%@",accountId,amount,bankCardId,operName,password];
    // 因为是demo，key写死了，所以这里传空
    NSString *sign = [AES encryptAES:oSign key:nil];
    
    NSString *url = PAYURL(accountId, amount, bankCardId, operName, password);
    
    [NetworkingTools getDataWithURL:url  sign:sign Block:^(id result) {
        completionBlock(result,nil);

    } ErrorBlock:^(NSError *error) {
        NSLog(@"error:%@",error);
            
    }];

}

@end
